
package com.cainli.image;

import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.ConstantState;
import android.support.v4.util.LruCache;
import android.util.Pair;

/**
 * MemoryCache, 该类是线程安全的
 * key为String
 * value中第一个值为Drawable.ConstantState, 第二个值为cache的大小
 * 
 *
 */
public class MemoryCache extends LruCache<String, Pair<Drawable.ConstantState, Integer>>
{

    public MemoryCache(int maxSize)
    {
        super(maxSize);
    }

    @Override
    protected int sizeOf(String key, Pair<ConstantState, Integer> value)
    {
        return value.second;
    }
}
